import React, { Component } from 'react'
import Child from './Child'
import MyContxt from './MyContext'
import CommonContext from './CommonContext'

export default class Parent extends Component {
  // static contextType = MyContxt;

  constructor() {
    super()
    this.state = {
      name: "hanye",
      age: 18,
      title: "from parent title"
    }
  }

  render() {
    return (
      <div>
        <MyContxt.Provider value={this.state} >
          {/* <CommonContext.Provider value={{title:'gp18'}}> */}
            {this.context.name}
            <hr />
            <Child></Child>
          {/* </CommonContext.Provider> */}
        </MyContxt.Provider>
      </div>
    )
  }
}
